package com.meichis.yndms.vm;

import androidx.lifecycle.MutableLiveData;

import com.meichis.yndms.model.BusinessBoard;
import com.meichis.yndms.repository.manager.BusinessBoardManager;

import java.util.List;

public class MonthBusinessAmountVm extends MyViewModel {

    private MutableLiveData<List<BusinessBoard>> purchaseAmount;
    private MutableLiveData<List<BusinessBoard>> saleAmount;

    public MutableLiveData<List<BusinessBoard>> getPurchaseAmount() {
        if (purchaseAmount == null) {
            purchaseAmount = new MutableLiveData<>();
        }
        return purchaseAmount;
    }

    public MutableLiveData<List<BusinessBoard>> getSaleAmount() {
        if (saleAmount == null) {
            saleAmount = new MutableLiveData<>();
        }
        return saleAmount;
    }

    public void getMonthPurchaseAmount() {
        BusinessBoardManager.getInstance().getMonthProductPurchaseByBrand(getShowDialog(),
                getUserInfo().getValue().getOrgId(), getUserInfo().getValue().getId(), getPurchaseAmount());
    }

    public void getMonthSaleAmount() {
        BusinessBoardManager.getInstance().getMonthProductSalesSummaryByBrand(getShowDialog(),
                getUserInfo().getValue().getOrgId(), getUserInfo().getValue().getId(), getSaleAmount());
    }
}
